package cn.tedu.oop2;
/**练习多态的使用*/
public class TestCar {
    public static void main(String[] args) {
        Car c=new Car();
        BMW b=new BMW();

        System.out.println(c.getColor());
        c.start();
        c.stop();
        System.out.println(b.getColor());
        System.out.println(b.color);
        Car c2=new TSL();
        System.out.println(c2.getColor());
        c2.start();
        c2.stop();

    }

}
class Car{
    private String brand;
    private String color ;
    private int id;
    private double price;

    public void start(){
        System.out.println("我的小车车启动了");
    }
    public void stop(){
        System.out.println("我的小车停下了");
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }
}
class BMW extends Car{
    String color="五彩斑斓的黑";
    @Override
    public void start(){
        System.out.println("都让开,我要起飞了");
    }
}
class TSL extends Car{
    @Override
    public void stop(){
        System.out.println("怎么停不下来呢");
    }
    public void swim(){
        System.out.println("我还是个潜水艇");
    }
}